package com.project.server.controller;

import com.project.server.common.Result;
import com.project.server.model.Dish;
import com.project.server.service.DashboardService;
import com.project.server.vo.DashboardStatsVO;
import com.project.server.vo.RevenueVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;

@Tag(name = "仪表盘")
@RestController
@RequestMapping("/api/dashboard")
@RequiredArgsConstructor
public class DashboardController {

    private final DashboardService dashboardService;

    @Operation(summary = "获取统计数据")
    @GetMapping("/stats")
    public Result<DashboardStatsVO> getStats() {
        return dashboardService.getStats();
    }


    @Operation(summary = "获取热门菜品")
    @GetMapping("/hot-dishes")
    public Result<List<Dish>> getHotDishes(@RequestParam(defaultValue = "10") Long limit) {
        return Result.success(dashboardService.getHotDishes(limit));
    }
}
